package com.trhui.mallbook.client;

import com.trhui.mallbook.domain.common.ApiRequest;
import com.trhui.mallbook.domain.common.BaseResponse;
import com.trhui.mallbook.domain.request.QueryUserRequest;
import com.trhui.mallbook.domain.request.hf.HfQueryRcvCertRequest;
import com.trhui.mallbook.domain.request.hf.HfQueryUserRequest;
import com.trhui.mallbook.domain.response.dg.DgQueryUserResponse;
import com.trhui.mallbook.domain.response.hf.HfQueryRcvCertResponse;
import com.trhui.mallbook.domain.response.hf.HfQueryUserResponse;
import com.trhui.mallbook.domain.response.xib.XibQueryUserResponse;
import com.trhui.mallbook.domain.response.yb.YbQueryUserResponse;
import com.trhui.mallbook.enums.ChannelTypeEnum;
import com.trhui.mallbook.enums.ServerCodeEnum;

/**
 * 子商户查询
 *
 * @author linqy
 */
public class UserQueryClient extends AbstractClient {

    /**
     * 汇付-子商户查询
     *
     * @param request
     * @return
     */
    public static BaseResponse<HfQueryUserResponse> hfQuery(HfQueryUserRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_USER)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(apiRequest, HfQueryUserResponse.class);
    }

    /**
     * 易宝-子商户查询
     *
     * @param request
     * @return
     */
    public static BaseResponse<YbQueryUserResponse> ybQuery(QueryUserRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_USER)
                .channelType(ChannelTypeEnum.YB)
                .build();
        return post(apiRequest, YbQueryUserResponse.class);
    }

    /**
     * 厦门国际银行-子商户查询
     *
     * @param request
     * @return
     */
    public static BaseResponse<XibQueryUserResponse> xibQuery(QueryUserRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_USER)
                .channelType(ChannelTypeEnum.XIB)
                .build();
        return post(apiRequest, XibQueryUserResponse.class);
    }

    /**
     * 汇付-收款子商户证照审核状态查询接口
     *
     * @param request
     * @return
     */
    public static BaseResponse<HfQueryRcvCertResponse> hfQueryRcvCert(HfQueryRcvCertRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_RCV_CERT)
                .channelType(ChannelTypeEnum.HF)
                .build();
        return post(apiRequest, HfQueryRcvCertResponse.class);
    }
    /**
     * 斗拱-子商户查询
     *
     * @param request
     * @return
     */
    public static BaseResponse<DgQueryUserResponse> dgQuery(QueryUserRequest request) {
        ApiRequest apiRequest = new ApiRequest.ApiRequestBuild()
                .merOrderId(request.getMerOrderId())
                .merchantNo(request.getMerchantNo())
                .params(request)
                .serverCode(ServerCodeEnum.QUERY_USER)
                .channelType(ChannelTypeEnum.DG)
                .build();
        return post(apiRequest, DgQueryUserResponse.class);
    }
}
